package com.miaoda.miaoda_ai.service;

import com.miaoda.miaoda_ai.model.dto.chathistory.ChatHistoryQueryRequest;
import com.miaoda.miaoda_ai.model.entity.User;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.miaoda.miaoda_ai.model.entity.ChatHistory;

import java.time.LocalDateTime;

/**
 * 对话历史 服务层。
 *
 * @author <a href="https://github.com/luyixun123asdf"> luyixun</a>
 */
public interface ChatHistoryService extends IService<ChatHistory> {
    /**
     * 新增对话历史
     *
     * @param appId       app的id
     * @param message     消息
     * @param messageType 消息类型
     * @param userId      用户id
     * @return 是否成功
     */
    boolean addChatMessage(Long appId, String message, String messageType, Long userId);

    boolean deleteByAppId(Long appId);

    QueryWrapper getQueryWrapper(ChatHistoryQueryRequest chatHistoryQueryRequest);

    Page<ChatHistory> listAppChatHistoryByPage(Long appId, int pageSize,
                                               LocalDateTime lastCreateTime,
                                               User loginUser);
}
